package com.example.keli.ui.my.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.keli.R;
import com.example.keli.base.utils.GlideUtil;
import com.example.keli.ui.my.model.LoveReciveBean;
import com.example.keli.ui.my.model.VoteReceiveBean;
import com.example.keli.ui.userinfo.UserInfoDialog;

import java.util.List;

/**
 * description:
 * author: Allen
 * date: 2019/3/19 11:51
 */
public class VoteDetailAdapter extends BaseQuickAdapter<VoteReceiveBean.DataBean.UserInfoBean, BaseViewHolder> {

    public VoteDetailAdapter(List<VoteReceiveBean.DataBean.UserInfoBean> mData, Context context) {
        super(R.layout.item_info_common, mData);
    }

    @Override
    protected void convert(BaseViewHolder helper, final VoteReceiveBean.DataBean.UserInfoBean mListBean) {
        helper.setText(R.id.tv_name, mListBean.getNickname());
        helper.setVisible(R.id.tv_right_title, true);
        helper.setText(R.id.tv_right_title, String.format("%s 票", mListBean.getNum()));
        ImageView cover = helper.getView(R.id.iv_avatar);
        GlideUtil.display(cover.getContext(), cover, mListBean.getAvatar());

        cover.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                new UserInfoDialog(mContext, mListBean.getUid()).show();
            }
        });
    }

}
